function createThunkMiddleware(extraArgument){
    return ({dispatch,getState})=>next=>action=>{
        if(typeof action === 'function'){
            action(dispatch, getState, extraArgument);
        }else{
            next(action);
        }
    }
}

const thunk = createThunkMiddleware();
thunk.withExtraArgument = createThunkMiddleware;
export default thunk;
